package com.catazy.album.domain.model

import com.catazy.album.domain.enum.ImageSize


internal data class Album(
    val name: String,
    val artist: String,
    val mbId: String? = null,
    val images: List<Image> = emptyList(),
    val tracks: List<Track>? = null,
    val tags: List<Tag>? = null,
) {

    val id: String = "$artist - $name"

    // firstOrNull() 用于返回集合中第一个满足给定谓词的元素，如果没有元素满足谓词，则返回 null
    fun getDefaultImageUrl() = images.firstOrNull { it.size == ImageSize.EXTRA_LARGE }?.url
}
